using UnityEngine;

namespace IQIGame.Onigao.Framework.Serialization
{
    public class Float3 : ISerializeByteBuf
    {
        public float x;
        public float y;
        public float z;

        public Float3()
        {
        }

        public Float3(float x, float y, float z)
        {
            this.x = x;
            this.y = y;
            this.z = z;
        }

        public Float3(Vector3 vector)
        {
            this.x = vector.x;
            this.y = vector.y;
            this.z = vector.z;
        }

        public void Serialize(ByteBuf _buf)
        {
            _buf.WriteFloat(this.x);
            _buf.WriteFloat(this.y);
            _buf.WriteFloat(this.z);
        }

        public void DeSerialize(ByteBuf _buf)
        {
            this.x = _buf.ReadFloat();
            this.y = _buf.ReadFloat();
            this.z = _buf.ReadFloat();
        }
    }
}
